<include file="Public/header" /> 

<!--主窗体-->
<div class="container app">
	<!--左侧菜单-->
	<include file="Public/sidebar" /> 
	<!--左侧菜单//-->
	
	<!-- mainCon -->
	<div id="mainCon" class="mainCon">
		<h4>产品列表</h4>
		<div class="bs-example-bg-classes">
			<p class="bg-warning">说明：添加产品后在文章编辑器哪里插入</p>
		</div>
		<div>
		<form class="form-inline" method="get">
			<div class="form-group form-group-sm">
				<label for="title">产品名称：</label>
				<input type="text" class="form-control" id="title" name="title" placeholder="产品名称" value="<{$title}>">
			</div>

			<div class="form-group form-group-sm">
				<label for="title">产品分类名称：</label>
				<input type="text" class="form-control" id="category" name="category" placeholder="产品分类名称" value="<{$category}>">
			</div>

			<div class="bk10"></div>
			<div class="form-group form-group-sm">
				<label for="">创建时间：</label>
				<input type="text" class="form-control laydate-icon" id="start_time" name="start_time"  value="<{$start_time?($start_time|date='Y-m-d H:i:s',###):''}>" >
				<span>-</span>
				<input type="text" class="form-control laydate-icon" id="end_time" name="end_time"  value="<{$end_time?($end_time|date='Y-m-d H:i:s',###):''}>" >
			</div>
			<div class="bk10"></div>
			<div class="form-group form-group-sm">
				<label for="member_disable">状态：</label>
				<select id="status" name="status" class="form-control">
					<option value="all" <if condition="$status eq 'all'">selected</if>>全部</option>
					<option value="1" <if condition="$status === 1">selected</if>>显示</option>
					<option value="0" <if condition="$status === 0">selected</if>>隐藏</option>
				</select>
			</div>

			<button type="submit" class="btn btn-default btn-sm">产品筛选</button>
		</form>
		</div>
		<div class="bk10"></div>
		<!-- <div>
			<a href="<{:U('Admin/ArticleSite/articleAdd',array('k'=>1,'sk'=>11))}>" class="btn btn-default">添加文章</a>
		</div> -->
		<div class="bk10"></div>
		<table class="table table-bordered table-hover">
			<tr>
				<th>编号</th>
				<th>产品名称</th>
				<th>产品图片</th>
				<th>所属分类</th>
				<th>创建人</th>
				<th>创建时间</th>
				<th>状态</th>
				<th>排序</th>
				<th>操作</th>
			</tr>

			<empty name="list">
				<tr><td colspan="8" style="text-align:center;color:#999">～暂无数据～</td></tr>
			<else /> 

				<foreach name="list" item="vo">
					<tr>
						<td><{$vo['id']}></td>
						<td style="width:200px"><{$vo['title']}></td>
						<td><img src="<{$vo['thumb']}>" style="width:100px"></td>
						<td style="width:150px">
							<{$vo['name']}>
						</td>
						<td>
							<if condition="session('nickname') neq ''">
								<{$Think.session.nickname}>
							<else />
								<{$Think.session.username}>
							</if> 
						</td>
						<td><{$vo['createtime']|date="Y-m-d H:i",###}></td>
						<td>
							<if condition="$vo['status'] eq 1">
								<span style="color:#66CC33">显示</span>
							<else />
								<span style="color:#FFA530">隐藏</span>
							</if>
						</td>
						<td><{$vo['taxis']}></td>
						<td>
							<a href="<{:U('Admin/Product/add_product',array('id'=>$vo['id'],'k'=>11,'sk'=>4))}>">编辑</a>
							<a href="javascript:void(0)" class="delAct" data-id="<{$vo['id']}>">删除</a>
						</td>
					</tr>
				</foreach>
			
			</empty>
			
		</table>
		
		<div class="pagebar">
			<{$pager}>
		</div>
		
	</div>
	<!-- mainCon// -->
	
</div>
<!--主窗体//-->

<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
$(function(){

	var start = {
		elem: '#start_time',
		format: 'YYYY/MM/DD hh:mm:ss',
		istime: true,
		istoday: false,
		choose: function(datas){
			 end.min = datas;
			 end.start = datas;
		}
	};
	var end = {
		elem: '#end_time',
		format: 'YYYY/MM/DD hh:mm:ss',
		istime: true,
		istoday: false,
		choose: function(datas){
			start.max = datas;
		}
	};
	laydate(start);
	laydate(end);
	
	$(".delAct").click(function(){
		var that = this;
		layer.confirm('您是否确认删除该记录？删除后不可恢复！', {icon: 3, title:'提示'}, function(index){
			var itemid = $(that).attr("data-id");
			$.post("<{:U('Admin/Product/delAct')}>",{id:itemid},function(r){
				if(r.error == 1){
					layer.close(index);
					layer.alert(r.errmsg,{icon: 2});
				}else{
					window.location.reload();
				}
			});
		});
		return false;
	});
});
</script>

<include file="Public/footer" /> 